(function(vc,vm){

    vc.extends({
        data:{
            editChainInoutOrderInfo:{
                orderId:'',
csId:'',

            }
        },
         _initMethod:function(){

         },
         _initEvent:function(){
             vc.on('editChainInoutOrder','openEditChainInoutOrderModal',function(_params){
                $that.refreshEditChainInoutOrderInfo();
                $('#editChainInoutOrderModel').modal('show');
                vc.copyObject(_params, $that.editChainInoutOrderInfo );
                $that.editChainInoutOrderInfo.communityId = vc.getCurrentCommunity().communityId;
            });
        },
        methods:{
            editChainInoutOrderValidate:function(){
                        return vc.validate.validate({
                            editChainInoutOrderInfo:$that.editChainInoutOrderInfo
                        },{
                            'editChainInoutOrderInfo.csId':[
{
                            limit:"required",
                            param:"",
                            errInfo:"供应商ID不能为空"
                        },
 {
                            limit:"maxLength",
                            param:"32",
                            errInfo:"供应商ID不能为空"
                        },
                    ],
'editChainInoutOrderInfo.orderId':[
{
                            limit:"required",
                            param:"",
                            errInfo:"采集订单ID不能为空"
                        }]

                        });
             },
            editChainInoutOrder:function(){
                if(!$that.editChainInoutOrderValidate()){
                    vc.toast(vc.validate.errInfo);
                    return ;
                }

                vc.http.apiPost(
                    'chainInoutOrder.updateChainInoutOrder',
                    JSON.stringify($that.editChainInoutOrderInfo),
                    {
                        emulateJSON:true
                     },
                     function(json,res){
                        //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
                        let _json = JSON.parse(json);
                        if (_json.code == 0) {
                            //关闭model
                            $('#editChainInoutOrderModel').modal('hide');
                             vc.emit('chainInoutOrderManage','listChainInoutOrder',{});
                            return ;
                        }
                        vc.toast(_json.msg);
                     },
                     function(errInfo,error){
                        console.log('请求失败处理');

                        vc.toast(errInfo);
                     });
            },
            refreshEditChainInoutOrderInfo:function(){
                $that.editChainInoutOrderInfo= {
                  orderId:'',
csId:'',

                }
            }
        }
    });

})(window.vc,window.vc.component);
